<template>
	<swiper indicator-dots autoplay circular :interval="3000" :duration="1000" :style="getstyle">
		<swiper-item v-for="i in swipers">
			<view class="swiper-item"><image :src="i.src" :style="getstyle" @click="event(i.src)"></image></view>
		</swiper-item>
	</swiper>
</template>

<script>
	export default{
		props:{
			swipers:Array,
			height:{
				type:String,
				default:"350rpx"
			},
			preview:{
				type:Boolean,
				default:false
			}
		},
		computed:{
			getstyle(){
				return `height: ${this.height}rpx;`
			}
		},
		methods:{
			event(item){
				let arrs = this.swipers.map(res=>{
							return res.src
						})
				if(this.preview){
					uni.previewImage({
						urls:arrs,
						current:item,
						loop:true
					})
				}
			}
		}
	}
</script>

<style>

</style>
